package com.nulldev.util.net.packets;

import com.nulldev.util.logging.Logger;
import com.nulldev.util.logging.LoggerFactory;

public abstract class UniversalPacket extends NetPacket {

	private final Logger log;
	
	public UniversalPacket(String packetName, String id, String data) {
		super(packetName, id, data, PacketType.UNIVERSAL);
		this.log = LoggerFactory.getLoggerName(id, true, true);
	}
	
	public UniversalPacket(String packetName, String id, byte[] data) {
		super(packetName, id, data, PacketType.UNIVERSAL);
		this.log = LoggerFactory.getLoggerName(id, true, true);
	}
	
	public UniversalPacket(String packetName, String id) {
		this(packetName, id, "");
	}

	@Override
	public abstract void client(final byte[] data, final byte[] raw, final NetInfo client);

	@Override
	public abstract void server(final byte[] data, final byte[] raw, final NetInfo connection);

	public Logger logger() {
		return this.log;
	}
}
